
// This function processes moon quiz data
function submitTest()
{
	var numberCorrect = 0;
	
	var q1 = document.forms.test.question1;
	var q2 = document.forms.test.question2;
	var q3 = document.forms.test.question3;
	var q4 = document.forms.test.question4;
	var q5 = document.forms.test.question5;
	var q6 = document.forms.test.question6;
	var q7 = document.forms.test.question7;
	var q8 = document.forms.test.question8;
	var q9 = document.forms.test.question9;
	var q10 = document.forms.test.question10;



	
	var q1 = document.forms.test.question1;
	if(q1[ 1 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q2 = document.forms.test.question2;
	if(q2[ 2 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q3 = document.forms.test.question3;
	if(q3[ 0 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q4 = document.forms.test.question4;
	if(q4[ 1 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q5 = document.forms.test.question5;
	if(q5[ 0 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q6 = document.forms.test.question6;
	if(q6[ 0 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q7 = document.forms.test.question7;
	if(q7[ 3 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q8 = document.forms.test.question8;
	if(q8[ 2 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q9 = document.forms.test.question9;
	if(q9[ 0 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var q10 = document.forms.test.question10;
	if(q10[ 1 ].checked == true )
	{
		numberCorrect = numberCorrect + 1;
	}
	
	var score = numberCorrect / 10 * 100;
	var percentage = numberCorrect / 10;
	
	if( score >= 70 )
		
		{
		 alert( "Congratulation you passed the tset! Your score is " + numberCorrect + " out of 10" + " Click on the link below to print your Certificate of Completion." );
		document.getElementById( "certificate-link" ).innerHTML = " <a href='certificate.html'> View Certificate</a> ";
		}	

	else
		{
		alert( "Sorry you did not pass the test!  Your score is " + numberCorrect + " out of 10"   );
		window.location.href="home-page.html";
		}
	
	
	
	// here in my code, score is now a value between 0 and 100 
	
	// call the function to report scores
	parent.reportScores( percentage );
}

